<?php
namespace app\home\controller\team;
use app\home\controller\Base;

class Api extends Base
{

	/**
	 * 我的推荐会员列表接口
	 * @return [type] [description]
	 */
	public function member_rows(){
		$params = $this->request->param();
        
        $perpagenum = isset($params['limit'])?intval($params['limit']):15;
        $perpagenum = $perpagenum>100?100:$perpagenum;
        $page = isset($params['page'])?intval($params['page']):1;
        $page = $page<1?1:$page;

        unset($params['limit']);
        unset($params['page']);
        $where = [];
        if(isset($params['key'])){
            $where= parseWhere($params['key'],true);
        }
        $where['inviter_id'] = UID;

        $data = model('member')->getPageDatas($where,$page,$perpagenum);
        $data['code'] = 1;
        return json($data);
	}
	
	/**
	 * 报单申请数据列表接口
	 * @return [type] [description]
	 */
	public function apply_record(){
		$params = $this->request->param();
        
        $perpagenum = isset($params['limit'])?intval($params['limit']):15;
        $perpagenum = $perpagenum>100?100:$perpagenum;
        $page = isset($params['page'])?intval($params['page']):1;
        $page = $page<1?1:$page;

        unset($params['limit']);
        unset($params['page']);
        $where = [];
        if(isset($params['key'])){
            $where= parseWhere($params['key']);
        }
        $where['uid'] = UID;

        $data = model('member_apply')->getPageDatas($where,$page,$perpagenum);
        $data['code'] = 1;
        return json($data);
	}

}